J2PrinterWebStartTest Application --------------------------------- Created with Xcode 3.1.1, Mac OS X 10.5.5. (For Windows, see "Win/J2PrinterWebStartTest".) Brief Description: This sample demonstrates the use of the J2PrinterWorks class J2PrinterWebStart which enables J2PrinterWorks-based printing from Java Web Start applications. The following JNLP API is used by J2PrinterWebStartTest: PrintService: This interface provides methods for access to JNLP printing functions. In particular, the methods showPageFormatDialog(PageFormat) and print(Pageable) are used. Java Web Start is launched automatically by the browser when the user clicks on a link which is associated with JNLP file. It then downloads and caches J2PrinterWebStartTest on the local client machine where the browser is running. When invoked next time, this cached application is run without downloading and runs as fast as a traditionally installed application. By default applications are run in a protective environment (sandbox) with restricted access to local disk and network resources. Java Web Start only transfers JAR files from the Web server to the location determined by it on the client machine. For more details on Java Web Start product and JNLP API, please check the Sun online documentation at http://java.sun.com/products/javawebstart/developers.html or http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp. Files for Java Web Start (Mac OS X): bin - This directory containing .class files is generated by the Xcode/Ant build process. build - This directory is generated by Xcode and contains intermediate files. build.xml - This file is used by Xcode and Ant to build the application. It is kind of Makefile for the Ant tool. dist - This directory contains .jar, .html, and .jnlp files for distribution to the target web site. J2PrinterWebStartTest.xcodeproj - This file is the Xcode 3.1.1 project file. Double-click this file to launch Xcode to build and run J2PrinterWebStartTest. jars - This directory contains Xcode intermediate .jar files. lib - This directory contains .jar files required at compilation time. Place a copy of J2PrinterWorks.jar in this directory before building the application. readme.txt - This file. resources - This directory has the .html, .jnlp, and Manifest source files required for J2PrinterWebStartTest. src - This directory has the required Java source file: J2PrinterWebStartTest.java Building & Testing J2PrinterWebStartTest (Mac OS X): 1) Place a copy of your J2PrinterWorks.jar in the lib folder. 2) Double-click the Xcode project file J2PrinterWebStartTest.xcodeproj to launch Xcode. Verify that these files are present in the Xcode project: readme.txt build.xml src/J2PrinterWebStartTest.java resources/J2PrinterWebStartTest.html resources/J2PrinterWebStartTest.jnlp resources/Manifest lib/J2PrinterWorks.jar lib/jnlp.jar 3) The file build.xml installs files onto your local machine, in the user's default website location "Sites"; you will need to turn on Web Sharing in System Preferences. A copy of J2PrinterWorks.jar must be in the lib folder. 4) In the file J2PrinterWebStartTest.html if necessary, modify the path to J2PrinterWebStartTest.jnlp in the href tag to point to your web server location. This change should be needed only if you modified the installation target location in the build.xml file. 5) In the file J2PrinterWebStartTest.jnlp modify the tag "codebase=" to point to the location on your web server where J2PrinterWebStartTest will be installed, e.g. codebase="http://www.yourwebsite.com/J2PrinterWebStartTest" Save your changes. 6) Build and run J2PrinterWebStartTest with the Xcode Build and Go commands. Ant is the external Java-based build tool used by Xcode for building this application; for more information, check http://jakarta.apache.org/. Deployment of J2PrinterWebStartTest: Java Web Start applications may be installed on any J2EE-compliant server. The resources required for this, including .jnlp and .jar files, may be packed into a Web Archive (.war) file. For information on server deployment, see the Sun web site and your server documentation.